

package consultorio;
import java.util.Calendar;
import javax.swing.ImageIcon;
import java.awt.*;
import java.awt.print.*;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
public class FichaPaciente extends javax.swing.JFrame implements Printable
{

    /**
     * Creates new form FichaPaciente
     */
    public FichaPaciente() {
        initComponents();
        //falta centralizar
        try{
       setIconImage(new ImageIcon (getClass().getResource("/Imagenes/logoct.jpg")).getImage()); }
        catch (Exception ex){
                }
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jDialog1 = new javax.swing.JDialog();
        jSeparator1 = new javax.swing.JSeparator();
        jRadioButton1 = new javax.swing.JRadioButton();
        jMenuItem1 = new javax.swing.JMenuItem();
        jSeparator5 = new javax.swing.JSeparator();
        fichapanel = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jSeparator2 = new javax.swing.JSeparator();
        jSeparator3 = new javax.swing.JSeparator();
        jLabel4 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        Historial = new javax.swing.JTable();
        jLabel5 = new javax.swing.JLabel();
        jSeparator4 = new javax.swing.JSeparator();
        jLabel6 = new javax.swing.JLabel();
        txtPaciente = new javax.swing.JLabel();
        txtFecha = new javax.swing.JLabel();
        txtTipo = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        txtMedico = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jScrollPane5 = new javax.swing.JScrollPane();
        txtDiagnostico = new javax.swing.JTextArea();
        jLabel10 = new javax.swing.JLabel();
        jScrollPane6 = new javax.swing.JScrollPane();
        txtTratamiento = new javax.swing.JTextArea();
        jLabel11 = new javax.swing.JLabel();
        jScrollPane7 = new javax.swing.JScrollPane();
        observaciones = new javax.swing.JTextArea();
        IMPRIME = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jButton1 = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();
        jLabel16 = new javax.swing.JLabel();
        jLabel17 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        jLabel19 = new javax.swing.JLabel();
        TR = new javax.swing.JTextField();
        CR = new javax.swing.JTextField();
        CR2 = new javax.swing.JTextField();
        AR = new javax.swing.JTextField();
        jPanel3 = new javax.swing.JPanel();
        jLabel20 = new javax.swing.JLabel();
        jLabel21 = new javax.swing.JLabel();
        jLabel22 = new javax.swing.JLabel();
        jLabel23 = new javax.swing.JLabel();
        CE = new javax.swing.JTextField();
        TE = new javax.swing.JTextField();
        AE = new javax.swing.JTextField();
        BE = new javax.swing.JTextField();
        jPanel4 = new javax.swing.JPanel();
        jLabel24 = new javax.swing.JLabel();
        jLabel25 = new javax.swing.JLabel();
        jLabel26 = new javax.swing.JLabel();
        jLabel27 = new javax.swing.JLabel();
        BP = new javax.swing.JTextField();
        OP = new javax.swing.JTextField();
        HP = new javax.swing.JTextField();
        GP = new javax.swing.JTextField();
        jLabel12 = new javax.swing.JLabel();
        jSeparator6 = new javax.swing.JSeparator();

        javax.swing.GroupLayout jDialog1Layout = new javax.swing.GroupLayout(jDialog1.getContentPane());
        jDialog1.getContentPane().setLayout(jDialog1Layout);
        jDialog1Layout.setHorizontalGroup(
            jDialog1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 400, Short.MAX_VALUE)
        );
        jDialog1Layout.setVerticalGroup(
            jDialog1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 300, Short.MAX_VALUE)
        );

        jRadioButton1.setText("jRadioButton1");

        jMenuItem1.setText("jMenuItem1");

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setBackground(new java.awt.Color(255, 255, 255));
        setResizable(false);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowOpened(java.awt.event.WindowEvent evt) {
                formWindowOpened(evt);
            }
        });

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel1.setText("CONSULTORIO \"Tú te Sanas\"");

        jLabel2.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel2.setText("PACIENTE:");

        jLabel3.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel3.setText("FECHA:");

        jSeparator2.setForeground(new java.awt.Color(0, 0, 0));

        jSeparator3.setForeground(new java.awt.Color(0, 0, 0));

        jLabel4.setBackground(new java.awt.Color(0, 0, 0));
        jLabel4.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel4.setText("  HISTORIAL");

        Historial.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null}
            },
            new String [] {
                "FECHA", "DIAGNOSTICO", "TRATAMIENTO"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        Historial.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                HistorialMouseClicked(evt);
            }
        });
        jScrollPane1.setViewportView(Historial);
        if (Historial.getColumnModel().getColumnCount() > 0) {
            Historial.getColumnModel().getColumn(0).setResizable(false);
            Historial.getColumnModel().getColumn(1).setResizable(false);
            Historial.getColumnModel().getColumn(2).setResizable(false);
        }

        jLabel5.setBackground(new java.awt.Color(0, 0, 0));
        jLabel5.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel5.setText("CONFIRMACION DE REGISTRO DE CONSULTAS");

        jSeparator4.setForeground(new java.awt.Color(0, 0, 0));

        jLabel6.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel6.setText("TIPO DE CONSULTA:");

        jLabel8.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel8.setText("MEDICO TRATANTE:");

        jLabel7.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel7.setText("ÓRDENES DE EXÁMENES SOLICITADOS:");

        jLabel9.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel9.setText("DIAGNOSTICO: ");

        txtDiagnostico.setColumns(20);
        txtDiagnostico.setRows(5);
        jScrollPane5.setViewportView(txtDiagnostico);

        jLabel10.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel10.setText("TRATAMIENTO:");

        txtTratamiento.setColumns(20);
        txtTratamiento.setRows(5);
        jScrollPane6.setViewportView(txtTratamiento);

        jLabel11.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel11.setText("OBSERVACIONES:");

        observaciones.setColumns(20);
        observaciones.setRows(5);
        jScrollPane7.setViewportView(observaciones);

        IMPRIME.setText("IMPRIMIR");
        IMPRIME.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                IMPRIMEActionPerformed(evt);
            }
        });

        jButton2.setText("ACEPTAR");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        jButton1.setText("CANCELAR");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Resonancia Magnetica"));

        jLabel16.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel16.setText("Tórax");

        jLabel17.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel17.setText("Columna");

        jLabel18.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel18.setText("Cabeza");

        jLabel19.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel19.setText("Abdomen");

        TR.setEditable(false);
        TR.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        TR.setForeground(new java.awt.Color(240, 240, 240));
        TR.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        TR.setAutoscrolls(false);
        TR.setBorder(null);
        TR.setDisabledTextColor(new java.awt.Color(51, 51, 51));
        TR.setEnabled(false);
        TR.setFocusable(false);
        TR.setOpaque(false);
        TR.setRequestFocusEnabled(false);
        TR.setSelectedTextColor(new java.awt.Color(240, 240, 240));
        TR.setSelectionColor(new java.awt.Color(240, 240, 240));
        TR.setVerifyInputWhenFocusTarget(false);

        CR.setEditable(false);
        CR.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        CR.setForeground(new java.awt.Color(240, 240, 240));
        CR.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        CR.setAutoscrolls(false);
        CR.setBorder(null);
        CR.setDisabledTextColor(new java.awt.Color(51, 51, 51));
        CR.setEnabled(false);
        CR.setFocusable(false);
        CR.setOpaque(false);
        CR.setRequestFocusEnabled(false);
        CR.setSelectedTextColor(new java.awt.Color(240, 240, 240));
        CR.setSelectionColor(new java.awt.Color(240, 240, 240));
        CR.setVerifyInputWhenFocusTarget(false);

        CR2.setEditable(false);
        CR2.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        CR2.setForeground(new java.awt.Color(240, 240, 240));
        CR2.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        CR2.setAutoscrolls(false);
        CR2.setBorder(null);
        CR2.setDisabledTextColor(new java.awt.Color(51, 51, 51));
        CR2.setEnabled(false);
        CR2.setFocusable(false);
        CR2.setOpaque(false);
        CR2.setRequestFocusEnabled(false);
        CR2.setSelectedTextColor(new java.awt.Color(240, 240, 240));
        CR2.setSelectionColor(new java.awt.Color(240, 240, 240));
        CR2.setVerifyInputWhenFocusTarget(false);

        AR.setEditable(false);
        AR.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        AR.setForeground(new java.awt.Color(240, 240, 240));
        AR.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        AR.setAutoscrolls(false);
        AR.setBorder(null);
        AR.setDisabledTextColor(new java.awt.Color(51, 51, 51));
        AR.setEnabled(false);
        AR.setFocusable(false);
        AR.setOpaque(false);
        AR.setRequestFocusEnabled(false);
        AR.setSelectedTextColor(new java.awt.Color(240, 240, 240));
        AR.setSelectionColor(new java.awt.Color(240, 240, 240));
        AR.setVerifyInputWhenFocusTarget(false);

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(AR)
                    .addComponent(TR, javax.swing.GroupLayout.DEFAULT_SIZE, 33, Short.MAX_VALUE)
                    .addComponent(CR2)
                    .addComponent(CR, javax.swing.GroupLayout.Alignment.TRAILING))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jLabel16, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jLabel17, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jLabel18, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jLabel19, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(28, 28, 28))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel16)
                    .addComponent(TR, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel17)
                    .addComponent(CR, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel18)
                    .addComponent(CR2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel19)
                    .addComponent(AR, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Ecografías"));

        jLabel20.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel20.setText("Cabeza");

        jLabel21.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel21.setText("Tórax");

        jLabel22.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel22.setText("Abdomen");

        jLabel23.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel23.setText("Brazo");

        CE.setEditable(false);
        CE.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        CE.setForeground(new java.awt.Color(240, 240, 240));
        CE.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        CE.setAutoscrolls(false);
        CE.setBorder(null);
        CE.setDisabledTextColor(new java.awt.Color(51, 51, 51));
        CE.setEnabled(false);
        CE.setFocusable(false);
        CE.setOpaque(false);
        CE.setRequestFocusEnabled(false);
        CE.setSelectedTextColor(new java.awt.Color(240, 240, 240));
        CE.setSelectionColor(new java.awt.Color(240, 240, 240));
        CE.setVerifyInputWhenFocusTarget(false);

        TE.setEditable(false);
        TE.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        TE.setForeground(new java.awt.Color(240, 240, 240));
        TE.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        TE.setAutoscrolls(false);
        TE.setBorder(null);
        TE.setDisabledTextColor(new java.awt.Color(51, 51, 51));
        TE.setEnabled(false);
        TE.setFocusable(false);
        TE.setOpaque(false);
        TE.setRequestFocusEnabled(false);
        TE.setSelectedTextColor(new java.awt.Color(240, 240, 240));
        TE.setSelectionColor(new java.awt.Color(240, 240, 240));
        TE.setVerifyInputWhenFocusTarget(false);

        AE.setEditable(false);
        AE.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        AE.setForeground(new java.awt.Color(240, 240, 240));
        AE.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        AE.setAutoscrolls(false);
        AE.setBorder(null);
        AE.setDisabledTextColor(new java.awt.Color(51, 51, 51));
        AE.setEnabled(false);
        AE.setFocusable(false);
        AE.setOpaque(false);
        AE.setRequestFocusEnabled(false);
        AE.setSelectedTextColor(new java.awt.Color(240, 240, 240));
        AE.setSelectionColor(new java.awt.Color(240, 240, 240));
        AE.setVerifyInputWhenFocusTarget(false);

        BE.setEditable(false);
        BE.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        BE.setForeground(new java.awt.Color(240, 240, 240));
        BE.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        BE.setAutoscrolls(false);
        BE.setBorder(null);
        BE.setDisabledTextColor(new java.awt.Color(51, 51, 51));
        BE.setEnabled(false);
        BE.setFocusable(false);
        BE.setOpaque(false);
        BE.setRequestFocusEnabled(false);
        BE.setSelectedTextColor(new java.awt.Color(240, 240, 240));
        BE.setSelectionColor(new java.awt.Color(240, 240, 240));
        BE.setVerifyInputWhenFocusTarget(false);

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(BE)
                    .addComponent(CE, javax.swing.GroupLayout.DEFAULT_SIZE, 33, Short.MAX_VALUE)
                    .addComponent(AE)
                    .addComponent(TE, javax.swing.GroupLayout.Alignment.TRAILING))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jLabel20, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jLabel21, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jLabel22, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jLabel23, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(28, 28, 28))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel20)
                    .addComponent(CE, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel21)
                    .addComponent(TE, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel22)
                    .addComponent(AE, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel23)
                    .addComponent(BE, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder("Principales"));

        jLabel24.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel24.setText("Bioquímica");

        jLabel25.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel25.setText("Orina");

        jLabel26.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel26.setText("Haces");

        jLabel27.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel27.setText("Glucosa");

        BP.setEditable(false);
        BP.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        BP.setForeground(new java.awt.Color(240, 240, 240));
        BP.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        BP.setAutoscrolls(false);
        BP.setBorder(null);
        BP.setDisabledTextColor(new java.awt.Color(51, 51, 51));
        BP.setEnabled(false);
        BP.setFocusable(false);
        BP.setOpaque(false);
        BP.setRequestFocusEnabled(false);
        BP.setSelectedTextColor(new java.awt.Color(240, 240, 240));
        BP.setSelectionColor(new java.awt.Color(240, 240, 240));
        BP.setVerifyInputWhenFocusTarget(false);

        OP.setEditable(false);
        OP.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        OP.setForeground(new java.awt.Color(240, 240, 240));
        OP.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        OP.setAutoscrolls(false);
        OP.setBorder(null);
        OP.setDisabledTextColor(new java.awt.Color(51, 51, 51));
        OP.setEnabled(false);
        OP.setFocusable(false);
        OP.setOpaque(false);
        OP.setRequestFocusEnabled(false);
        OP.setSelectedTextColor(new java.awt.Color(240, 240, 240));
        OP.setSelectionColor(new java.awt.Color(240, 240, 240));
        OP.setVerifyInputWhenFocusTarget(false);

        HP.setEditable(false);
        HP.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        HP.setForeground(new java.awt.Color(240, 240, 240));
        HP.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        HP.setAutoscrolls(false);
        HP.setBorder(null);
        HP.setDisabledTextColor(new java.awt.Color(51, 51, 51));
        HP.setEnabled(false);
        HP.setFocusable(false);
        HP.setOpaque(false);
        HP.setRequestFocusEnabled(false);
        HP.setSelectedTextColor(new java.awt.Color(240, 240, 240));
        HP.setSelectionColor(new java.awt.Color(240, 240, 240));
        HP.setVerifyInputWhenFocusTarget(false);

        GP.setEditable(false);
        GP.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        GP.setForeground(new java.awt.Color(240, 240, 240));
        GP.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        GP.setAutoscrolls(false);
        GP.setBorder(null);
        GP.setDisabledTextColor(new java.awt.Color(51, 51, 51));
        GP.setEnabled(false);
        GP.setFocusable(false);
        GP.setOpaque(false);
        GP.setRequestFocusEnabled(false);
        GP.setSelectedTextColor(new java.awt.Color(240, 240, 240));
        GP.setSelectionColor(new java.awt.Color(240, 240, 240));
        GP.setVerifyInputWhenFocusTarget(false);

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(GP)
                    .addComponent(BP, javax.swing.GroupLayout.DEFAULT_SIZE, 33, Short.MAX_VALUE)
                    .addComponent(HP)
                    .addComponent(OP, javax.swing.GroupLayout.Alignment.TRAILING))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jLabel24, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jLabel25, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jLabel26, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jLabel27, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(28, 28, 28))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel24)
                    .addComponent(BP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel25)
                    .addComponent(OP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel26)
                    .addComponent(HP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel27)
                    .addComponent(GP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        jLabel12.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel12.setText("Firma Medico");

        javax.swing.GroupLayout fichapanelLayout = new javax.swing.GroupLayout(fichapanel);
        fichapanel.setLayout(fichapanelLayout);
        fichapanelLayout.setHorizontalGroup(
            fichapanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jSeparator3)
            .addGroup(fichapanelLayout.createSequentialGroup()
                .addGap(1, 1, 1)
                .addGroup(fichapanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(fichapanelLayout.createSequentialGroup()
                        .addGap(9, 9, 9)
                        .addComponent(jSeparator2))
                    .addGroup(fichapanelLayout.createSequentialGroup()
                        .addGroup(fichapanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(fichapanelLayout.createSequentialGroup()
                                .addComponent(jLabel6)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(txtTipo, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(jLabel7)
                            .addGroup(fichapanelLayout.createSequentialGroup()
                                .addGroup(fichapanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jLabel11)
                                    .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(18, 18, 18)
                                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(fichapanelLayout.createSequentialGroup()
                                .addComponent(jScrollPane7, javax.swing.GroupLayout.PREFERRED_SIZE, 405, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGroup(fichapanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(fichapanelLayout.createSequentialGroup()
                                        .addGap(18, 18, 18)
                                        .addGroup(fichapanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jSeparator6, javax.swing.GroupLayout.PREFERRED_SIZE, 96, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(jLabel12)))
                                    .addGroup(fichapanelLayout.createSequentialGroup()
                                        .addGap(42, 42, 42)
                                        .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                        .addGroup(fichapanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(fichapanelLayout.createSequentialGroup()
                                .addGap(48, 48, 48)
                                .addGroup(fichapanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addGroup(fichapanelLayout.createSequentialGroup()
                                        .addComponent(jLabel8)
                                        .addGap(18, 18, 18)
                                        .addComponent(txtMedico, javax.swing.GroupLayout.PREFERRED_SIZE, 123, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addComponent(jLabel9)
                                    .addComponent(jLabel10)
                                    .addComponent(jScrollPane5)
                                    .addComponent(jScrollPane6))
                                .addGap(0, 0, Short.MAX_VALUE))
                            .addGroup(fichapanelLayout.createSequentialGroup()
                                .addGap(18, 18, 18)
                                .addComponent(IMPRIME, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                .addContainerGap())
            .addGroup(fichapanelLayout.createSequentialGroup()
                .addGroup(fichapanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 398, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(fichapanelLayout.createSequentialGroup()
                        .addGap(210, 210, 210)
                        .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 272, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(fichapanelLayout.createSequentialGroup()
                        .addGap(170, 170, 170)
                        .addComponent(jSeparator4, javax.swing.GroupLayout.PREFERRED_SIZE, 340, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(fichapanelLayout.createSequentialGroup()
                        .addGap(230, 230, 230)
                        .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(fichapanelLayout.createSequentialGroup()
                .addComponent(jLabel2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txtPaciente, javax.swing.GroupLayout.PREFERRED_SIZE, 171, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txtFecha, javax.swing.GroupLayout.PREFERRED_SIZE, 210, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(266, 266, 266))
            .addGroup(fichapanelLayout.createSequentialGroup()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 842, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, Short.MAX_VALUE))
        );
        fichapanelLayout.setVerticalGroup(
            fichapanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(fichapanelLayout.createSequentialGroup()
                .addGap(5, 5, 5)
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSeparator3, javax.swing.GroupLayout.PREFERRED_SIZE, 4, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(7, 7, 7)
                .addGroup(fichapanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(txtPaciente, javax.swing.GroupLayout.PREFERRED_SIZE, 12, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtFecha, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(fichapanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel2)
                        .addComponent(jLabel3)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel4)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel5)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSeparator4, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(8, 8, 8)
                .addGroup(fichapanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(fichapanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jLabel8, javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(txtMedico, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(txtTipo, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel6))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(fichapanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7)
                    .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(fichapanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(fichapanelLayout.createSequentialGroup()
                        .addGroup(fichapanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel11)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane7, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(fichapanelLayout.createSequentialGroup()
                        .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 133, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(fichapanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(fichapanelLayout.createSequentialGroup()
                                .addComponent(jLabel10)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(fichapanelLayout.createSequentialGroup()
                                .addComponent(jLabel12)
                                .addGap(28, 28, 28)
                                .addComponent(jSeparator6, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 14, Short.MAX_VALUE)
                        .addGroup(fichapanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(IMPRIME, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(14, 14, 14))))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(fichapanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(fichapanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened
        /* Metodo actualizar historial, actualiza la tabla "Historial"*/
       
        /* Arreglo con los nombre de cada columna de la tabla "Historial" agregamos los dato a la tabla*/
        String[] columna = {"Fecha","Diagnostico","Tratamiento"};
        // se utiliza la funcion
        datos = p.buscarPaciente();
        // se colocan los datos en la tabla
        DefaultTableModel datosP = new DefaultTableModel(datos,columna);
        Historial.setModel(datosP);
        obtenerFecha();
    }//GEN-LAST:event_formWindowOpened

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        /* Abrimos la ventana "Principal" & cerramos el actual */
        Principal v =new Principal();
        v.setVisible(true);
        dispose();
    }//GEN-LAST:event_jButton1ActionPerformed

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        // TODO add your handling code here
    }//GEN-LAST:event_jButton2ActionPerformed

    private void IMPRIMEActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_IMPRIMEActionPerformed
        /* Metodo para imprimir los datos, solo imprime teto (Borra los botones)*/
        try
        {
            PrinterJob gup=PrinterJob.getPrinterJob();
            gup.setPrintable(this);
            boolean top=gup.printDialog();
            if(top)
            {
                gup.print();
            }
        }
        catch(PrinterException pex)
        {
            JOptionPane.showMessageDialog(null, "ERROR DE PROGRAMA", "Error/n" + pex, JOptionPane.INFORMATION_MESSAGE);
        }
    }//GEN-LAST:event_IMPRIMEActionPerformed

    private void HistorialMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_HistorialMouseClicked
        /* Ver datos al hacer clic en cada dato de la tabla "Historial" */
        fila = Historial.rowAtPoint(evt.getPoint());
        if (fila> -1)
        {
            String tipo = (String)datos[fila][5];

            txtDiagnostico.setText      (String.valueOf(Historial.getValueAt(fila, 1)));
            txtTratamiento.setText      (String.valueOf(Historial.getValueAt(fila, 2)));
            txtPaciente.setText         ((String)datos[fila][3]);
            txtMedico.setText           ((String)datos[fila][4]);
            observaciones.setText       ((String)datos[fila][7]);

            /*Comprobamos si es "Consulta"('C') o "Revision de examen" ('R'). Los (' ') son como está en la base de datos */
            switch(tipo)
            {
                case "C":
                txtTipo.setText("Consulta");
                break;
                case "R":
                txtTipo.setText("Revisión de examen");
                break;
            }

            /* AQUI VIENE PARA LOS DETALLES MEDICOS*/
            String codigo = (String) datos[fila][6];
            p.detallesConsulta(codigo);

        }
    }//GEN-LAST:event_HistorialMouseClicked

    /**
     * @param args the command line arguments
     */
        Pacientes p = new Pacientes();
        Object[][] datos;
        int fila = -1;
        
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(FichaPaciente.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(FichaPaciente.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(FichaPaciente.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(FichaPaciente.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new FichaPaciente().setVisible(true);
            }
        });
    }
    
    public void obtenerFecha(){
        /* Obtenemos la fecha actual con las librerias Calendar */
        Calendar cal1 = Calendar.getInstance();
        String fecha = "" + cal1.get(Calendar.DATE)      + "/" + 
                            cal1.get(Calendar.MONTH)+ 1  + "/" +
                            cal1.get(Calendar.YEAR)      + " " +
                            cal1.get(Calendar.HOUR)      + ":" +
                            cal1.get(Calendar.MINUTE)    + ":" +
                            cal1.get(Calendar.SECOND);
        txtFecha.setText(fecha);
    }
   
 
    // Variables declaration - do not modify//GEN-BEGIN:variables
    public static javax.swing.JTextField AE;
    public static javax.swing.JTextField AR;
    public static javax.swing.JTextField BE;
    public static javax.swing.JTextField BP;
    public static javax.swing.JTextField CE;
    public static javax.swing.JTextField CR;
    public static javax.swing.JTextField CR2;
    public static javax.swing.JTextField GP;
    public static javax.swing.JTextField HP;
    private javax.swing.JTable Historial;
    private javax.swing.JButton IMPRIME;
    public static javax.swing.JTextField OP;
    public static javax.swing.JTextField TE;
    public static javax.swing.JTextField TR;
    private javax.swing.JPanel fichapanel;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JDialog jDialog1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JRadioButton jRadioButton1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JScrollPane jScrollPane6;
    private javax.swing.JScrollPane jScrollPane7;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JSeparator jSeparator3;
    private javax.swing.JSeparator jSeparator4;
    private javax.swing.JSeparator jSeparator5;
    private javax.swing.JSeparator jSeparator6;
    private javax.swing.JTextArea observaciones;
    private javax.swing.JTextArea txtDiagnostico;
    private javax.swing.JLabel txtFecha;
    private javax.swing.JLabel txtMedico;
    private javax.swing.JLabel txtPaciente;
    private javax.swing.JLabel txtTipo;
    private javax.swing.JTextArea txtTratamiento;
    // End of variables declaration//GEN-END:variables

    @Override
    public int print(Graphics graf, PageFormat pagfor, int index) throws PrinterException {
       
        {
            if(index>0)
               return NO_SUCH_PAGE; 
        }
        Graphics2D hub= (Graphics2D) graf;
        hub.translate(pagfor.getImageableX()*30, pagfor.getImageableY()*30);
        hub.scale(1.0, 1.0);
        
        fichapanel.printAll(graf);
        return PAGE_EXISTS;
    }
}
